define(function(require, exports) {
	var c1 = require('c1');

	var c1Page = {};

	c1Page = {
	  isInit : false,
	  init : function(fn) {
		  c1Page.fn = fn;

		  if (!this.isInit) {
			  $(document).on("click", 'form[name="siteUrlEditForm"] .c1-save', c1Page.saveClick);

			  $(document).on("click", 'form[name="siteUrlEditForm"] .c1-back', c1Page.backClick);

			  this.isInit = true;
		  }
	  },
	  saveClick : function() {
		  c1.message.progress();

		  var url = $('form[name="siteUrlEditForm"]').attr('action');

		  var data = c1.form.serializeJson('form[name="siteUrlEditForm"]');

		  $.post(url, data, function(data) {
			  c1.message.progress('close');

			  if (data.code != '0') {
				  c1.message.alert({
				    title : '提示消息',
				    message : data.message
				  });

				  return;
			  }

			  c1.message.alert({
			    title : '提示消息',
			    message : data.message,
			    fn : function() {
				    if ($.isFunction(c1Page.fn)) {
					    c1Page.fn();
				    }

				    c1Page.backClick();
			    }
			  });
		  });
	  },
	  backClick : function() {
		  $('.c1-modal').modal('hide').find('.modal-body').html('');
	  }
	};

	return {
		init : c1Page.init
	};
});